]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
StEntry: remove special redundant hover tracking
authorDan Winship <danw@gnome.org>
Wed, 16 Feb 2011 17:02:14 +0000 (12:02 -0500)
committerDan Winship <danw@gnome.org>
Fri, 18 Feb 2011 14:50:14 +0000 (09:50 -0500)
For historical reasons, StEntry always did hover tracking when you had
visible hint_text, even if track_hover was FALSE. Remove that special
case, and make entries track hover just like all other widgets do.

If we actually needed to distinguish hovered-with-hint-text from
hovered-without-hint-text (which, at the moment, we don't), we could
do that by setting separate CSS for :hover and :hover:indeterminate.

https://bugzilla.gnome.org/show_bug.cgi?id=642483

js/ui/viewSelector.js
src/st/st-entry.c

index 3e1f21034cdb127a7359a59f0c0f4aca99edb3b2..f59dccb877d73bd93b3648ddb537bdcc786a774f 100644 (file)
@@ -23,7 +23,8 @@ function SearchEntry(focusBase) {
 SearchEntry.prototype = {
     _init : function(focusBase) {
         this.actor = new St.Entry({ name: 'searchEntry',
-                                    hint_text: _("Search your computer") });
+                                    hint_text: _("Search your computer"),
+                                    track_hover: true });
         this.entry = this.actor.clutter_text;
 
         this.actor.clutter_text.connect('text-changed', Lang.bind(this,
@@ -73,13 +74,7 @@ SearchEntry.prototype = {
     },
 
     reset: function () {
-        let [x, y, mask] = global.get_pointer();
-        let actor = global.stage.get_actor_at_pos (Clutter.PickMode.REACTIVE,
-                                                   x, y);
-        // this.actor is never hovered directly, only its clutter_text and icon
-        let hovered = this.actor == actor.get_parent();
-
-        this.actor.set_hover(hovered);
+        this.actor.sync_hover();
 
         this.entry.text = '';
 
index fe0fe34bbc35a07e0e9e6523fbf41b01b31de064..0cded5a49cf20e91a55d38d4baed751e25f59fb4 100644 (file)
@@ -599,31 +599,6 @@ st_entry_key_focus_in (ClutterActor *actor)
   clutter_actor_grab_key_focus (priv->entry);
 }
 
-static gboolean
-st_entry_enter_event (ClutterActor         *actor,
-                      ClutterCrossingEvent *event)
-{
-  StEntryPrivate *priv = ST_ENTRY_PRIV (actor);
-
-  if (clutter_actor_contains (actor, event->source)
-      && priv->hint && priv->hint_visible)
-    {
-      st_widget_set_hover (ST_WIDGET (actor), TRUE);
-    }
-
-  return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->enter_event (actor, event);
-}
-
-static gboolean
-st_entry_leave_event (ClutterActor         *actor,
-                      ClutterCrossingEvent *event)
-{
-  if (!clutter_actor_contains (actor, event->related))
-    st_widget_set_hover (ST_WIDGET (actor), FALSE);
-
-  return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->leave_event (actor, event);
-}
-
 static void
 st_entry_class_init (StEntryClass *klass)
 {
@@ -649,8 +624,6 @@ st_entry_class_init (StEntryClass *klass)
 
   actor_class->key_press_event = st_entry_key_press_event;
   actor_class->key_focus_in = st_entry_key_focus_in;
-  actor_class->enter_event = st_entry_enter_event;
-  actor_class->leave_event = st_entry_leave_event;
 
   widget_class->style_changed = st_entry_style_changed;
   widget_class->navigate_focus = st_entry_navigate_focus;